package com.deepocean.controller;

import com.deepocean.common.entity.ResultEntity;
import com.deepocean.entity.FloatationMachineCondition;
import com.deepocean.entity.FloatationMachineEntity;
import com.deepocean.service.IFloatationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 浮选机
 */
@RestController
@RequestMapping("/floatation")
public class FloatationController {
    @Autowired
    private IFloatationService floatationService;

    /**
     * 新增接口
     * @param floatationMachineEntity
     * @return
     */
    @PostMapping("/v1/add")
    public ResultEntity add(@RequestBody FloatationMachineEntity floatationMachineEntity) {
        return ResultEntity.success(floatationService.add(floatationMachineEntity));
    }

    /**
     * 一小时内物料输入输出总和
     * @param deviceId
     * @return
     */
    @PostMapping("/v1/getInAndOutInHour")
    public ResultEntity getInAndOutInHour(@RequestParam String deviceId) {
        return ResultEntity.success(floatationService.getInAndOutInHour(deviceId));
    }

    /**
     * 条件查询
     * @param floatationMachineCondition
     * @return
     */
    @PostMapping("/v1/getFloatationByCondition")
    public ResultEntity getFloatationByCondition(@RequestBody FloatationMachineCondition floatationMachineCondition) {
        return ResultEntity.success(floatationService.getFloatationByCondition(floatationMachineCondition));
    }

    /**
     * 根据设备型号获取理论数据
     * @return
     */
    @PostMapping("/v1/getTheoryData")
    public ResultEntity getTheoryData(String deviceType) {
        return ResultEntity.success("理论数据");
    }
}
